The ReleaseDate property is a DateTime, which is not nullable.
When the document does not have a ReleaseDate, then it will return the default value of a DateTime object. The default is DateTime.MinValue, which is what you are seeing above.
So the "solution" depends on what you are looking to do. You could make your logic to check if the ReleaseDate is DateTime.MinValue, and then ignore it.
Have you considered using ucomponents ? I had the same issue a few months back and used Ucomponents which has some nice featues like GetReleaseDate and GetExpireDate.
Release date return {01/01/0001 00:00:00}
Hi,
I use umbraco 4.7.2 and I try to get the release date with this code :
new Document(id).ReleaseDate
But it always return {01/01/0001 00:00:00}.
Have you a solution please ??
Thank you
The ReleaseDate property is a DateTime, which is not nullable.
When the document does not have a ReleaseDate, then it will return the default value of a DateTime object. The default is DateTime.MinValue, which is what you are seeing above.
So the "solution" depends on what you are looking to do. You could make your logic to check if the ReleaseDate is DateTime.MinValue, and then ignore it.
Hi, thank you for your response.
But in my case, I have set a publish date and my code returns {01/01/0001 00:00:00}. instead of {11/07/2012 01:00:00}.
I just took a quick look at the source, and I can't see how that would happen.
Could you double check that you are getting the correct document, and the other properties are populated correctly?
Hi Koomos,
Have you considered using ucomponents ? I had the same issue a few months back and used Ucomponents which has some nice featues like GetReleaseDate and GetExpireDate.
Anyways here is how i solved it
//fuji
I use Ucomponents and it works fine, with this code :
uComponents.Core.uQuery.GetDocument(id).ReleaseDate
Thank you
Hmm, I'll have to take a look at what the difference is. Sounds like a bug, so should be reported so it can be fixed in the core.
is working on a reply...